/**
 * @author mithun
 */

Event.observe(window, 'load', function(event) {
	
	initMediaVersionBoxes();
	
});

var initMediaVersionBoxes = function(){
	
	getMediaVersions('text',  'textMediaVersions');
	getMediaVersions('image', 'imageMediaVersions');
	getMediaVersions('audio', 'audioMediaVersions');
	getMediaVersions('video', 'videoMediaVersions');
	
}



var getMediaVersions = function(mediaType, retDiv){
	
	var mediaId = $F('MediaId'); 
	new Ajax.Updater(
		retDiv,
		WEBROOT + 'medias/view_versions/' + mediaId + '/' + mediaType,
		{
			method: 'get',
			asynchronous:true,
			evalScripts :true,
			parameters  : {},
			requestHeaders:['X-Update', retDiv]
		}
	);
	
}